package com.good.child.pressent;

import android.content.Context;

import com.good.child.bean.constants.ConstantsBean;
import com.good.child.http.ConstantsLogical;
import com.good.child.iview.StudyGardenIView;
import com.yimidida.library.base.BasePresenter;
import com.yimidida.library.base.ICallBackResultListener;
import com.yimidida.library.tool.JsonSerializer;

/**
 * Create on: 2024/8/4
 * by Mr.Zhu
 * Description: TODO
 */
public class StudyGardenPresenter extends BasePresenter<StudyGardenIView> {


    private Context mContext;

    public StudyGardenPresenter(Context mContext) {
        this.mContext = mContext;
    }

    public void getConstantsList( ) {
        ConstantsLogical.getInstance().requestConstants(mContext, new ICallBackResultListener() {
            @Override
            public void onCallBack(Object result) {
                if (result == null) {
                    return;
                }
                String dataList = (String) result;
                ConstantsBean bean = JsonSerializer.deSerialize(dataList, ConstantsBean.class);
                if (bean == null) {
                    return;
                }
                mView.onSuccess(bean.data);
            }
        });
    }
}
